package com.principle.iterator;

import java.util.Iterator;

public class ComputerCollegeIterator implements Iterator {

   //这里需要 Department 是以怎么样的方式存放
    Department[] departments;
    int position=0;//遍历的位置

    public ComputerCollegeIterator(Department[] departments) {
        this.departments = departments;
    }

    @Override
    public void remove() {

    }

    @Override
    public boolean hasNext() {
        if(position>=departments.length||departments[position]==null){
            return false;
        }
        return true;
    }

    @Override
    public Department next() {
        Department department = departments[position];
        position+=1;
        return department;
    }
}
